﻿USE [QLTV]
GO
/****** Object:  StoredProcedure [dbo].[DauSach_TimDayDu_TenDS]    Script Date: 12/23/2014 2:35:36 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[DauSach_TimDayDu_NXB]
@search nvarchar(500)
as
begin
set @search = ''+'"'+@search+'*'+'"'+''
select MaDS, TenDS, TenTL, TenTG, TenNXB, NamXB, PARSENAME(convert(varchar,convert(money,TriGia),1),2 ) as TriGia,
case TrangThai when 1 then N'Được mượn' when 0 then N'Chưa được mượn' end as TrangThai
FROM ((DauSach JOIN TheLoai ON DauSach.MaTL = TheLoai.MaTL) JOIN TacGia ON DauSach.MaTG = TacGia.MaTG) JOIN NXB ON DauSach.MaNXB = NXB.MaNXB
WHERE contains(TenNXB, @search)
end